<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品配置信息</title>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<style>
    /*.page1{*/
        /*display: none;*/
    /*}*/
    .layui-input-block{
        /*margin-left: 40px;*/
    }
    .searchs{
        position: absolute;
        right: 200px;
    }
    .travel_list{
        height:200px;
        margin-left: 30px;
        margin-right: 30px;
        overflow-y: scroll;
    }

    .travel_tit{
        margin-left: 30px;
        margin-right: 30px;
    }
    .layui-table thead tr{
        background: #e6e6e6;
    }
    .page4-box{
        padding: 12px 16px;
    }
    .query-box{
        padding:20px 20px 10px 20px ;
        /*padding-top:20px;*/
        border: 1px solid #e6e6e6;
        min-height: 45px;
    }
    .selected_trip{
        border: 1px solid #e6e6e6;
    }
    .tripspan{
        margin-left: 40px;
        margin-right: 30px;
    }
    .tripspan span{
        line-height: 38px;
        background: #00a0e9;
        padding: 5px;
        border-radius: 10px;
        color: #fff;
    }
    .tag{
        float: left;
    }
    /*上一步下一步按钮居中*/
    .butcent{
        position: absolute;
        bottom: 20px;
        left: 40%;
        margin-left: 30%;
        width:20%;
        /*margin: 30px;*/
        padding: 30px;
    }

    .butcent2{
        margin-left: 70%;
        width:20%;
        padding: 30px;
    }

    .picturebut{
        /*background-color: #fbfdff;*/
        border: 1px solid #c0ccda;
        border-radius: 6px;
        box-sizing: border-box;
        font-size:22px;
        width:48%;
        height: 100%;
        margin-top:-10%;
        margin-left:-8%;
        cursor: pointer;
        line-height: 300px;
        vertical-align: top;
    }
    .page3{
        margin-left: 16%;
        margin-top: 20%;
    }
    .layui-form-select .layui-edge{
        display: none;
        right: 0;
    }
    th{
        text-align: left;
    }
    .layui-input{
        border-radius: 5px;
    }

</style>
<body>

<!--客户信息的弹窗的内容数据-->
<div>
    <form class="layui-form " id="tripconfig" action="">
        <div class="page1">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>产品配置信息</legend>
            </fieldset>
            <div class="layui-form-item ">
                <div class="layui-inline">
                    <div class="layui-form-item">
                        <label class="layui-form-label">产品编号</label>
                        <div class="layui-input-inline">
                            <input name="item_num" value="{notempty name='$trip'}{$trip.item_num}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                    </div>

                    <div class="layui-form-item " >
                        <label class="layui-form-label">供应商</label>
                        <div class="layui-input-inline" style="width: 450px">
                            <select  lay-filter="" id="supplier_id"  name="supplier_id"  lay-verify="required" lay-search>
                                <option value="77777"  {notempty name='$trip'}{if $trip.supplier_id==''} selected{/if}{/notempty}>无</option>
                                <option value="999999"  {notempty name='$trip'}{if $trip.supplier_id==999999} selected{/if}{/notempty}>自营</option>
                                {volist name="supplier" id="vo"}
                                <option value="{$vo.id}"  {notempty name='$trip'}{if $trip.supplier_id==$vo.id} selected{/if}{/notempty}>{$vo.name}</option>
                                {/volist}
                                <option value="1000000" {notempty name='$trip'}{if $trip.supplier_id==1000000} selected{/if}{/notempty}>其他</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width:60px;">
                            <button id="add_supplier_item_code" class="layui-btn layui-btn-radius layui-btn-primary layui-btn-small" style="width:50%;"><i class="layui-icon" style="margin-left: -9px;margin-top: -2px;"></i></button>
                        </div>
                    </div>

                    <div class="layui-form-item layui-hide" id="supplier_item_code_div">
                        <label class="layui-form-label">供应商<br/><span>(产品号)</span></label>
                        <div class="layui-input-inline">
                            <input name="supplier_item_code" id="supplier_item_code" value="{notempty name='$trip'}{$trip.supplier_item_code}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                    </div>



                    <div class="layui-form-item">
                        <label class="layui-form-label">平台产品名</label>
                        <div class="layui-input-inline" style="width: 500px">
                            <input name="product_name" value="{notempty name='$trip'}{$trip.product_name}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                    </div>




                    <div class="layui-form-item">
                        <label class="layui-form-label">预估价格（展示给客户）</label>
                        <div class="layui-input-inline" style="width: 500px">
                            <input name="budget_price" value="{notempty name='$trip'}{$trip.budget_price}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                    </div>



                    <div class="layui-form-item">
                        <label class="layui-form-label">售卖日期</label>
                        <div class="layui-input-inline">
                            <input name="sale_starttime" id="sale_starttime" value="{notempty name='$trip.sale_starttime'}{$trip.sale_starttime}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                        <div class="layui-input-inline" style="width:20px;height:40px;margin-left: 7px;line-height: 40px">至</div>
                        <div class="layui-input-inline">
                            <input name="sale_endtime" id="sale_endtime"  value="{notempty name='$trip.sale_endtime'}{$trip.sale_endtime}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                        <div class="layui-input-inline" style="width:60px;">
                            <button id="add_saletime_more" class="layui-btn layui-btn-radius layui-btn-primary layui-btn-small" style="width:50%"><i class="layui-icon" style="margin-left: -8px;"></i></button>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text layui-hide" id="saletime_mone_div">
                        <label class="layui-form-label">售卖日期<span>（补充）</span></label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea" id="saletime_more" name="saletime_more">{notempty name='$trip'}{$trip.saletime_more}{/notempty}</textarea>
                        </div>
                    </div>


                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">OTA售价（淡季）</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="ota_price_out">{notempty name='$trip'}{$trip.ota_price_out}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">OTA售价（旺季）</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="ota_price_busy">{notempty name='$trip'}{$trip.ota_price_busy}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">自有平台售价（淡季）</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="own_price_out">{notempty name='$trip'}{$trip.own_price_out}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">自有平台售价（旺季）</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="own_price_busy">{notempty name='$trip'}{$trip.own_price_busy}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label" style="text-align: center;">成本<br>（淡季）</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="cost_price_out">{notempty name='$trip'}{$trip.cost_price_out}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label" style="text-align: center;">成本<br>（旺季）</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="cost_price_busy">{notempty name='$trip'}{$trip.cost_price_busy}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">内部备注</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  name="description">{notempty name='$trip'}{$trip.description}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">简介</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容"  class="layui-textarea" id="introduce" name="introduction">{notempty name='$trip'}{$trip.introduction}{/notempty}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">费用包含</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  id="introduce2" name="price">{notempty name='$trip'}{$trip.price}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">费用不含</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  id="introduce3" name="priceno">{notempty name='$trip'}{$trip.priceno}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">注意事项</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea" id="introduce4" name="careful">{notempty name='$trip'}{$trip.careful}{/notempty}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">退改规则</label>
                        <div class="layui-input-block" style="max-width:500px;">
                            <textarea placeholder="请输入内容" class="layui-textarea"  id="introduce5" name="back">{notempty name='$trip'}{$trip.back}{/notempty}</textarea>
                        </div>
                    </div>
                    <!--<label class="layui-form-label"><span style="color: red">*</span>&nbsp;</label>-->
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">方案配置</label>
                        <div class="layui-input-block" style="margin-top:8px;">
                            <input type="checkbox" name="show_city_map" title="总行程地图"{if $trip.show_city_map=='1'}checked=""{/if}>
                            <input type="checkbox" name="show_day_map" title="每日地图"{if $trip.show_day_map=='1'}checked=""{/if}>
                            <input type="checkbox" name="showintroduction" title="简介" {if $trip.showintroduction!='0'}checked=""{/if}>
                            <input type="checkbox" name="showpricedetail" title="报价明细" {if $trip.showpricedetail!='0'}checked=""{/if}>
                            <input type="checkbox" name="showprice" title="费用说明" {if $trip.showprice!='0'}checked=""{/if}>
                            <input type="checkbox" name="showcareful" title="注意事项" {if $trip.showcareful!='0'}checked=""{/if}>
                            <input type="checkbox" name="showback" title="退改规则" {if $trip.showback!='0'}checked=""{/if}>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">POI配置</label>
                        <div class="layui-input-block" style="margin-top:8px;">
                            <input type="checkbox" name="showmobile" title="联系方式" {if $trip.showmobile=='1'}checked=""{/if}>
                            <input type="checkbox" name="showticket" title="门票信息" {if $trip.showticket=='1'}checked=""{/if}>
                            <input type="checkbox" name="showopen_time" title="开放时间" {if $trip.showopen_time=='1'}checked=""{/if}>
                            <input type="checkbox" name="showticket_url" title="订票官网"  {if $trip.showticket_url=='1'}checked=""{/if}>
                            <input type="checkbox" name="showpoicontent" title="中文介绍" {if $trip.showpoicontent=='1'}checked=""{/if}>
                            <input type="checkbox" name="showeng_introduce" title="英文介绍" {if $trip.showeng_introduce=='1'}checked=""{/if}>
                            <input type="checkbox" name="showdescription" title="特别说明" {if $trip.showdescription=='1'}checked=""{/if}>
                            <input type="checkbox" name="showcontent" title="备注" {if $trip.showcontent=='1'}checked=""{/if}>
                            <input type="checkbox" name="showthumb" title="图片" {if $trip.showthumb!='0'}checked=""{/if}>
                            <input type="checkbox" name="showsource" title="来源" {if $trip.showsource=='1'}checked=""{/if}>
                            <input type="checkbox" name="showaddress" title="地址" {if $trip.showaddress!='0'}checked=""{/if}>
                            <input type="checkbox" name="showgrade" title="星级"{if $trip.showgrade=='1'}checked=""{/if}>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

    <div class="layui-form-item">
        <div class="container">
            <div class="page1" style="text-align:center;">
                <button class="layui-btn" lay-submit lay-filter="updTripCfg">提交</button>
            </div>
        </div>
    </div>
</div>
</body>

<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
    layui.config({
        base : '__PUBLIC__/'
    }).extend({
        selectM: './multiple/selectM',
    }).use(['layer','form','jquery','selectM','laydate','table'],function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form,
            selectM = layui.selectM,
            laydate = layui.laydate,
            table = layui.table;
        laydate = layui.laydate;
        laydate.render({     //创建时间选择框
            elem: '#sale_starttime' //指定元素
            ,format: 'MM-dd'
        });
        laydate2 = layui.laydate;
        laydate2.render({     //创建时间选择框
            elem: '#sale_endtime' //指定元素
            ,format: 'MM-dd'
        });
        $(window).on('load', function() {
            //编辑时显示选中供应商
            var city_id = $("#city").val();
            var supplier_id = $("#supplier_id").val();
            if(city_id > 0){
                $.post("{:url('admin/poi/getPoi')}",{id:city_id},function(data){
                    if(data!=undefined&&data!=null&&data!=""){
                        var html="";
                        for(var i=0;i<data.length;i++){
                            if(supplier_id==data[i]["id"]){
                                html += "<option value="+data[i]["id"]+" selected>"+data[i]["name"]+"</option>";
                            }else{
                                html += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                            }
                        }
                    }else{
                        html += "<option value='0'>请选择</option>";
                    }
                    $("#supplier").html(html);
                    //重新渲染select
                    form.render('select');
                },"Json");
            }

            //初始化编辑时，展开有内容的售卖时间补充字段
            var sale_time_more = $("#saletime_more").val();
            if(sale_time_more){
                $('#saletime_mone_div').removeClass('layui-hide');
            }
            //初始化编辑时，展开有内容的售卖时间补充字段
            var s_item_code = $("#supplier_item_code").val();
            if(s_item_code){
                $('#supplier_item_code_div').removeClass('layui-hide');
            }

        });
        form.on('submit(updTripCfg)', function (data) {
            $.ajax({
                url: "{:url('admin/product/productconfig',['id'=>$trip['id']])}",
                data: $('#tripconfig').serialize(),
                type: 'post',
                async: false,
                success: function (res) {
                    var id = res.data;
                    parent.$("#tripid").attr("value", id);
                    layer.msg(res.msg);
                    if (res.code == 1) {
                        setTimeout(function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        }, 1500)
                    }
                }
            })
        });
        $(document).on('click','#add_saletime_more',function(){
            if($('#saletime_mone_div').hasClass("layui-hide")){
                $('#saletime_mone_div').removeClass('layui-hide');
            }else{
                $('#saletime_mone_div').addClass('layui-hide');
            }
            return false;
        });
        $(document).on('click','#add_supplier_item_code',function(){
            if($('#supplier_item_code_div').hasClass("layui-hide")){
                $('#supplier_item_code_div').removeClass('layui-hide');
            }else{
                $('#supplier_item_code_div').addClass('layui-hide');
            }
            return false;
        });
    })
</script>
<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('introduce',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            ['fullscreen', 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ]
    });
    var ue2 = UE.getEditor('introduce2',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            ['fullscreen', 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ]
    });
    var ue3 = UE.getEditor('introduce3',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            ['fullscreen', 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ]
    });
    var ue4 = UE.getEditor('introduce4',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            ['fullscreen', 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ]
    });
    var ue5 = UE.getEditor('introduce5',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            ['fullscreen', 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ]
    });
</script>
</html>